package com.zc.emos.wx.controller;

import com.zc.emos.wx.common.util.R;
import com.zc.emos.wx.controller.form.TestSayHelloForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author 曾川
 * @version 1.0.0
 * @ClassName TestController.java
 * @Description 测试controller
 * @createTime 2021年11月22日 14:11:00
 */
@RestController
@RequestMapping("/test")
@Api("测试web接口")
public class TestController {


    @PostMapping("/hello")
    @ApiOperation("最简单的测试方法")
    public R sayHello(@Valid @RequestBody TestSayHelloForm testSayHelloForm) {
        return R.ok().put("msg", "hello  world" + testSayHelloForm.getName());
    }

    @PostMapping("/addUser")
    @ApiOperation("/添加用户")
    //value填写权限类型，logical填写权限的关系，是and还是or？
    @RequiresPermissions(value = {"A","B"},logical = Logical.OR)
    public  R addUser(){
        return R.ok("添加用户成功");
    }

}
